/**
* Do a ajax request
* @param String url 	A url where request goes to.
* @param String func	The function to execute after finished
* @param String data	Parameters to send
* @param String nojson 	Output json?
*/

function ajax(url, func, data, nojson){
	var req;	
	req = new XMLHttpRequest();
	req.open("GET", url);
	req.onreadystatechange = function() {
		if(req.readyState == 4) {
			if(nojson == undefined && req.responseText != ''){
				var content = eval("(" + req.responseText + ")");
			}
			func(content, data);
		}
	}
	req.send();
}